import request from './request.js'

const key = '7d1b4919a8b7b719635ec70543d636b4'

// 根据IP获取城市信息
export const getCityByIP = () => {
  return request({
    method: 'GET',
    url: `/ip?key=${key}`,
  })
}
// 根据城市名称获取城市代码
export const getAdcodeByCity = (value) => {
  return request({
    method: 'GET',
    url: `/geocode/geo?address=${value}&key=${key}`,
  })
}
// 根据城市代码获取实时天气信息
export const getBaseWeatherByAdcode = (value) => {
  return request({
    method: 'GET',
    url: `/weather/weatherInfo?city=${value}&extensions=base&key=${key}`,
  })
}
// 根据城市代码获取全部天气信息
export const getAllWeatherByAdcode = (value) => {
  return request({
    method: 'GET',
    url: `/weather/weatherInfo?city=${value}&extensions=all&key=${key}`,
  })
}